package com.cbb.lease.controller;

import com.cbb.lease.pojo.entity.CarConfig;
import com.cbb.lease.pojo.entity.Shop;
import com.cbb.lease.service.ShopService;
import com.gsj.common.pojo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-eighth01
 * @description: 门店表 的 controller
 * @author: 陈斌斌
 * @create: 2021-07-24 19:09
 **/
@RestController
@RequestMapping("lease/shop")
@Api(value = "lease/shop")
public class ShopController {

    @Resource
    private ShopService shopService;

    @GetMapping("getAllShop")
    @ApiOperation(value = "getAllShop",httpMethod = "get")
    public R getAllShop(){
        return shopService.getAllShop();
    }



    @PostMapping("getAllShopPage/{currentPage}/{pageSize}")
    @ApiOperation(value = "getAllShopPage",httpMethod = "post")
    public R  getAllShopPage(@PathVariable("currentPage")Integer currentPage,
                             @PathVariable("pageSize")Integer pageSize,
                             @RequestBody Shop shop){
        return shopService.getAllShopPage(currentPage,pageSize,shop);
    }


    @ApiOperation(value = "delById",httpMethod = "delete")
    @DeleteMapping("delById")
    public R delById(@ApiParam(value = "类型主键ID")
                             Integer id){
        return shopService.delById(id);
    }

    @ApiOperation(value = "updateShop",httpMethod = "put")
    @PutMapping("updateShop")
    public R updateShop(@ApiParam(value = "config实体类")
                          @RequestBody Shop shop){
        return shopService.updateShop(shop);
    }


    @ApiOperation(value = "addShop",httpMethod = "post")
    @PostMapping ("addShop")
    public R addShop(@ApiParam(value = "config实体类")
                     @RequestBody Shop shop){
        return shopService.addShop(shop);
    }

}
